package com.itlong.cloud.user.propertyapp;

import com.itlong.cloud.POJO.DTO.app.property.app.PropertyAppDeviceInfoDTO;
import com.itlong.cloud.POJO.DTO.app.property.app.PropertyAppFeedbackInfoDTO;
import com.itlong.cloud.POJO.PO.PropertyRolePO;
import com.itlong.cloud.POJO.PO.PropertyUserInfoPO;
import com.itlong.cloud.POJO.VO.MessageVO;
import com.itlong.cloud.POJO.VO.app.AppGetQrcodeVO;
import com.itlong.cloud.POJO.VO.app.property.AppGetHouseholdCheckVO;
import com.itlong.cloud.POJO.VO.app.property.app.PropertyAppUserProjectInfoVO;
import com.itlong.cloud.POJO.VO.property.PropertyUserCacheVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * <desc>
 *      物业app用户信息暴露接口
 * </desc>
 *
 * @createDate  2019/12/25
 */
@FeignClient(name = "user-service")
public interface IPropertyAppUserInfoServiceClient {

    /**
     * <desc>
     *      从缓存中读取用户信息
     * </desc>
     *
     * @param token
     * @return
     * @Author Zhu.yj
     * @createDate  2019/12/25
     */
    @RequestMapping("/propertyapp/mine/retrieve")
    PropertyUserCacheVO retrieve(@RequestParam("token") String token);

    /**
     * <desc>
     *      获取住户审核列表
     * </desc>
     *
     * @param projectId 项目编号
     * @return List<AppGetHouseholdCheckVO> 住户审核信息集
     * @Author Juguang.S
     * @createDate  2019/12/30
     */
    @RequestMapping("/home/getHoldAuditList")
    public List<AppGetHouseholdCheckVO> getHoldAuditList(@RequestParam("projectId") String projectId);

    /**
     * <desc>
     *      住户审核通过
     * </desc>
     *
     * @param projectId 项目编号
     * @param auditId   审核通过信息ID
     * @param type    1审核通过 2审核拒绝
     * @return
     * @Author Juguang.S
     * @createDate  2019/12/30
     */
    @RequestMapping("/home/agreeHoldAudit")
    Integer agreeHoldAudit(@RequestParam("projectId") String projectId,@RequestParam("auditId") String auditId,@RequestParam("type") String type);

    /**
     * <desc>
     *      登录查询验证
     * </desc>
     *
     * @param params
     * @return
     * @Author Zhu.yj
     * @createDate  2019/12/30
     */
    @RequestMapping(value = "/mine/getPropertyUserInfo",method = RequestMethod.POST)
    PropertyUserInfoPO getPropertyUserInfo(@RequestBody Map<String, Object> params) throws Exception;

    /**
     * <desc>
     *      获取登录用户的项目列表
     * </desc>
     *
     * @param userId 用户id
     * @return projectMapList 包含pubKey,projectId,projectName
     * @Author Zhu.yj
     * @createDate  2019/12/30
     */
    @RequestMapping(value = "/mine/getProjectListByUserId",method = RequestMethod.POST)
    List<PropertyAppUserProjectInfoVO> getProjectListByUserId(@RequestParam("userId") String userId) throws Exception;

    /**
     * <desc>
     *      更改密码
     * </desc>
     *
     * @param params
     * @return
     * @Author Zhu.yj
     * @createDate  2019/12/31
     */
    @RequestMapping(value = "/mine/updatePropertyUserPassword",method = RequestMethod.POST)
    Integer updatePropertyUserPassword(@RequestBody Map<String, Object> params) throws Exception;

    /**
     * <desc>
     *      获取物业用户二维码
     * </desc>
     *
     * @param projectId 项目编号
     * @param userId 用户编号
     * @return AppGetQrcodeVO 返回app实体类
     * @Author Juguang.S
     * @createDate  2020/01/03
     */
    @RequestMapping(value = "/pass/getPropertyAppUserQRcode",method = RequestMethod.POST)
    AppGetQrcodeVO getPropertyAppUserQRcode(@RequestParam("projectId") String projectId,
                                            @RequestParam("userId") String userId) throws Exception;

    /**
     * <desc>
     *      处理物业用户未注册sip账号及未向灵云注册等问题
     * </desc>
     *
     * @param type 1为物业APP登录时调用 type 2为物业平台绑定手机号时调用
     * @Author Juguang.S
     * @createDate  2020/01/08
     */
    @RequestMapping(value = "/pass/savePropertyUserSipInfo",method = RequestMethod.POST)
    void savePropertyUserSipInfo (@RequestBody PropertyUserInfoPO userInfoPO,
                                  @RequestParam("projectId") String projectId,
                                  @RequestParam("type") Integer type) throws Exception;

    /**
     * <desc>
     *      初始化 物业项目人员类型表中的基础数据 只调取一次
     * </desc>
     *
     * @author Jugaung.S
     * @createDate 2021/04/12
     */
    @RequestMapping(value = "/pass/modifyPropertyUserTypeData",method = RequestMethod.POST)
    void modifyPropertyUserTypeData();

    /**
     * <desc>
     *      退出登录
     * </desc>
     *
     * @param userId 用户id
     * @return
     * @Author Zhu.yj
     * @createDate  2020/1/9
     */
    @PostMapping("/mine/loginOut")
    boolean loginOut(@RequestParam("userId") String userId) throws Exception;

    /**
     * <desc>
     *      物业APP用户上传设备排序
     * <desc/>
     *
     * @param propertyAppDeviceInfoDTO 设备排序相关数据
     * @return
     * @author Juguang.S
     * @createDate 2020-01-09
     */
    @RequestMapping(value = "/pass/upLoadAllSort",method = RequestMethod.POST)
    Integer upLoadAllSort(@RequestBody PropertyAppDeviceInfoDTO propertyAppDeviceInfoDTO) throws Exception;

    /**
     * <desc>
     *      物业APP用户上传组设备排序
     * <desc/>
     *
     * @param propertyAppDeviceInfoDTO 组设备排序相关数据
     * @return
     * @author Juguang.S
     * @createDate 2020-01-09
     */
    @RequestMapping(value = "/pass/deviceGroupSort",method = RequestMethod.POST)
    Integer deviceGroupSort(@RequestBody PropertyAppDeviceInfoDTO propertyAppDeviceInfoDTO) throws Exception;

    /**
     * <desc>
     *      更改头像或别名
     * </desc>
     *
     * @param params 更新参数包含 用户id和头像或别名
     * @return
     * @Author Zhu.yj
     * @createDate  2020/1/10
     */
    @PostMapping("/mine/updatePhotoOrName")
    Integer updatePhotoOrName(@RequestBody Map<String, Object> params) throws Exception;

    /**
     * <desc>
     *      登陆缓存用户信息
     * </desc>
     *
     * @param propertyUserInfoPO 物业用户信息PO
     * @param loginDevice 登录设备 1安卓 2苹果
     * @return
     * @Author Zhu.yj
     * @createDate  2020/1/14
     */
    @PostMapping("/mine/loginCacheUser")
    Map<String, Object> loginCacheUser(@RequestBody PropertyUserInfoPO propertyUserInfoPO,@RequestParam("loginDevice") String loginDevice) throws Exception;

    /**
     * <desc>
     *      获取通行记录列表信息
     * </desc>
     *
     * @param projectId 项目id
     * @param pageIndex
     * @param userId
     * @return
     * @Author Zhu.yj
     * @createDate  2020/1/14
     */
    @PostMapping("/mine/getPassRecordPage")
    Map<String, Object> getPassRecordPage(@RequestParam("projectId") String projectId,
                                          @RequestParam("pageIndex") String pageIndex,
                                          @RequestParam("userId") String userId) throws Exception;

    /**
     * <desc>
     *      保存反馈信息
     * </desc>
     *
     * @param propertyAppFeedbackInfoDTO 物业app反馈信息DTO
     * @return 受影响行数
     * @Author Zhu.yj
     * @createDate  2020/1/15
     */
    @PostMapping("/mine/saveFeedback")
    Integer saveFeedback(@RequestBody PropertyAppFeedbackInfoDTO propertyAppFeedbackInfoDTO) throws Exception;

    /**
     * <desc>
     *      查询历史反馈信息
     * </desc>
     *
     * @param userId 用户id
     * @param projectId 项目id
     * @param pageNum 页码
     * @return
     * @Author Zhu.yj
     * @createDate  2020/1/15
     */
    @PostMapping("/mine/getHistoryFeedback")
    Map<String,Object> getHistoryFeedback(@RequestParam("userId") String userId,
                                                       @RequestParam("projectId") String projectId,
                                                       @RequestParam("pageNum")String pageNum) throws Exception;

    /**
     * <desc>
     *      上传常用楼层
     * </desc>
     *
     * @param projectId 项目编号
     * @param deviceUnique 设备序列号
     * @param loadDeviceOrder 常用楼层名称
     * @return 1成功，0失败
     * @author Juguang.S
     * @createDate 2020/01/15
     */
    @RequestMapping(path = "/mine/uploadChoiceFloor")
    Integer uploadChoiceFloor(@RequestParam("projectId") String projectId,
                              @RequestParam("deviceUnique") String deviceUnique,
                              @RequestParam("loadDeviceOrder") String loadDeviceOrder,
                              @RequestParam("userId") String userId) throws Exception;

    /**
     * <desc>
     *      检查当前账号是否被锁定
     * </desc>
     *
     * @param accountNo 登录账号
     * @return
     * @Author Zhu.yj
     * @createDate  2020/2/27
     */
    @PostMapping("/mine/getPropertyAppAccountLockDetail")
    MessageVO getPropertyAppAccountLockDetail(@RequestParam("accountNo") String accountNo) throws Exception;

    /**
     * <desc>
     *      物业app登录错误处理
     * </desc>
     *
     * @param accountNo 登录账号
     * @return
     * @Author Zhu.yj
     * @createDate  2020/2/27
     */
    @PostMapping("/mine/propertyAppLoginErrorHandler")
    MessageVO propertyAppLoginErrorHandler(@RequestParam("accountNo") String accountNo) throws Exception;

    /**
     * <desc>
     *      获取物业角色详细信息
     * </desc>
     *
     * @param roleId 角色id
     * @return
     * @Author Zhu.yj
     * @createDate  2020/3/2
     */
    @PostMapping("/mine/getPubTypeByRole")
    List<PropertyRolePO> getPubTypeByRole(@RequestParam("roleId") String roleId) throws Exception;

    /**
     * <desc>
     *      根据userId获取第三方token
     * </desc>
     *
     * @param userId 用户id
     * @return
     * @Author Zhu.yj
     * @createDate  2020/3/2
     */
    @PostMapping("/mine/getUserClientToken")
    String getUserClientToken(@RequestParam("userId") String userId) throws Exception;

    /**
     * <desc>
     *      物业APP用户设置分组名称
     * <desc/>
     *
     * @param propertyAppDeviceInfoDTO 分组ID
     * @return
     * @author Juguang.S
     * @createDate 2020-01-09
     */
    @RequestMapping(value = "/pass/setDeGroupName",method = RequestMethod.POST)
    Integer setDeGroupName(@RequestBody PropertyAppDeviceInfoDTO propertyAppDeviceInfoDTO) throws Exception;

    /**
     * <desc>
     *      根据手机号获取物业用户信息
     * </desc>
     *
     * @param phoneNo
     * @return
     * @Author Zhu.yj
     * @createDate  2020/3/12
     */
    @PostMapping(value = "/propertyapp/user/getByAccount")
    PropertyUserInfoPO getByAccount(@RequestParam("phoneNo") String phoneNo) throws Exception;

    /**
     * <desc>
     *      更新用户当前项目id
     * </desc>
     *
     * @param projectId 项目id
     * @param userId 用户id
     * @return
     * @Author Zhu.yj
     * @createDate  2020/3/16
     */
    @PostMapping(value = "user/updateCurrentProjectId")
    Integer   updateCurrentProjectId(@RequestParam("projectId") String projectId,@RequestParam("userId") String userId) throws Exception;

    /**
     * <desc>
     *      根据deviceUnique查询居住楼层集合使用于物业APP
     * </desc>
     *
     * @param deviceUnique 设备唯一码
     * @return
     * @Author Juguang.S
     * @createDate  2020/04/16
     */
    @RequestMapping(value = "/pass/getLiveFloorByDeviceUnique",method = RequestMethod.POST)
    List<String> getLiveFloorByDeviceUnique(@RequestParam("deviceUnique") String deviceUnique);


}
